import request from "./request";
//小文件上次
export const upfiles = (params) => {
  const formData = new FormData();
  formData.append('file', params)
  return request({
    url: "/common/common/upload/file",
    requestBaseUrl: 'common',
    method: "post",
    data: formData,
  })
}
//视频分片上传
export const upVideos = () => {
  return request({
    url: '/common/common/upload/chunkUpload',

  })
}
//账号密码登录
export const psw_login = (username, password) => {
  const formData = new FormData();
  formData.append("username", username);
  formData.append("password", password);
  return request({
    url: "/expert/passport/userLogin",
    method: "post",
    data: formData,
  });
};
//短信登录接口
export const code_login = (code, mobile) => {
  const formData = new FormData();
  formData.append("code", code);
  formData.append("mobile", mobile);
  return request({
    url: "/expert/passport/smsLogin",
    method: "post",
    data: formData,
  });
};

//登录获取验证码
export const get_code = (mobile) => {
  return request({
    url: `/common/common/sms/LOGIN/${mobile}`,
    method: "get",
    requestBaseUrl: "common",
  });
};
//修改手机号获取验证码
export const emit_code = (mobile) => {
  return request({
    url: `/common/common/sms/EDIT_MOBILE/${mobile}`,
    method: "get",
    requestBaseUrl: "common",
  });
};
//获取登录信息
export const login_infofn = () => {
  return request({
    url: "/expert/passport",
    method: "get",
  });
};
//修改密码 
export const set_psw = (password, newPassword) => {
  const formData = new FormData();
  formData.append('newPassword', newPassword)
  formData.append('password', password)
  return request({
    url: "/expert/passport/modifyPass",
    method: "put",
    data: formData
  })
}
//修改  新手机号
export const set_phone = (mobile, code) => {
  const formData = new FormData();
  formData.append('mobile', mobile)
  formData.append('code', code)
  return request({
    url: "/expert/passport/editPhone",
    method: "post",
    data: formData
  })
}
//修改  验证旧手机号
export const old_phone = (mobile, code) => {
  const formData = new FormData();
  formData.append('mobile', mobile)
  formData.append('code', code)
  return request({
    url: "/expert/passport/verificationOldPhone",
    method: "post",
    data: formData
  })
}
//快速会诊---叫号器过号
export const over_sign = (id) => {
  return request({
    url: `/expert/pager/pager/miss/${id}`,
    method: 'get',
  })
}
//快速会诊---叫号器下一个
export const next_sign = (id) => {
  return request({
    url: `/expert/pager/pager/next/${id}`,
    method: 'get',
  })
}
//快速会诊---结束就诊
export const end_sign = (id) => {
  return request({
    url: `/expert/pager/pager/complete/${id}`,
    method: 'get',
  })
}
//快速会诊---叫号器列表
export const call_list = (params) => {
  return request({
    url: "/expert/pager/pager/getByExpertId",
    method: 'post',
    data: params
  })
}
//快速会诊--专家挂号单接诊
export const export_jiezhen = (userRegisterId) => {
  return request({
    url: `/buyer/user/userRegister/startUserRegister/${userRegisterId}`,
    method: "get",
    requestBaseUrl: 'buyer'
  })
}
//快速会诊--专家保存建议
export const export_register = (params) => {
  return request({
    url: '/buyer/user/userRegister/updateUserRegister',
    method: "post",
    data: params,
    requestBaseUrl: 'buyer'
  })
}
//快速会诊--专家结束就诊
export const complete_jz = (id) => {
  return request({
    url: `/expert/pager/pager/complete/${id}`,
    method: "get",
    requestBaseUrl: 'expert'
  })
}
//快速会诊--专家保存处方
export const save_cf = (params) => {
  return request({
    url: '/buyer/user/userRegister/updateExpertPrescription',
    method: "post",
    data: params,
    requestBaseUrl: 'buyer'
  })
}
//快速会诊--处方详情
export const prescription_detail = (userRegisterId) => {
  return request({
    url: `/buyer/user/userRegister/prescriptionDetails/${userRegisterId}`,
    method: "get",
    requestBaseUrl: "buyer"
  })
}
//我的会诊
export const my_huizhen = (params) => {
  return request({
    url: "/buyer/user/userRegister/pagelist",
    method: "post",
    data: params,
    requestBaseUrl: "buyer",
  });
};
//在线会诊
export const online_huizhen = (params) => {
  return request({
    url: "/buyer/order/userConsult/pagelist",
    method: "post",
    data: params,
    requestBaseUrl: "buyer",
  });
};
//健康科普
export const encyclopedia = (params) => {
  return request({
    url: "/expert/information/information/list",
    method: "post",
    data: params,
    requestBaseUrl: "expert",
  });
};
//健康科普--编辑草稿
export const encyclopedia_emit = (params) => {
  return request({
    url: "/expert/information/information/update",
    method: "post",
    data: params,
    requestBaseUrl: "expert",
  });
};
//健康科普--添加成草稿
export const encyclopedia_draft = (params) => {
  return request({
    url: "/expert/information/information/expertDraft",
    method: "post",
    data: params,
    requestBaseUrl: "expert",
  });
};
//健康科普--列表页发起审核
export const encyclopedia_shenhe = (informationId) => {
  return request({
    url: `/expert/information/information/expertRelease/${informationId}`,
    method: "get",
    requestBaseUrl: "expert",
  });
};
//健康科普--审核狀態查看
export const encyclopedia_status = (informationId) => {
  return request({
    url: `/expert/information/informationExamine/information/${informationId}`,
    method: "post",
    requestBaseUrl: "expert",
  });
};
//健康科普--获取文件名称
export const encyclopedia_getFileName = (params) => {
  let formData = new FormData()
  formData.append('filePath', params)
  return request({
    url: '/expert/information/information/fileName',
    method: "post",
    data: formData,
    requestBaseUrl: "expert",
  });
};
//健康科普--删除
export const encyclopedia_del = (ids) => {
  return request({
    url: `/expert/information/information/${ids}`,
    method: "delete",
    requestBaseUrl: "expert",
  });
};
//专家统计信息
export const export_infofn = (params) => {
  return request({
    url: "/expert/expert/expertStatistics/expertStatistics",
    method: 'get',
    data: {
      name: 'sadsa'
    },
    requestBaseUrl: "expert"
  })
}
//专家个人中心信息
export const expert_centerinfo = () => {
  return request({
    url: "/expert/passport/center",
    method: 'get',
    requestBaseUrl: 'expert'
  })
}
//修改专家个人中心信息
export const set_expert_centerinfo = (params) => {
  return request({
    url: "/expert/passport/editOwn",
    method: 'put',
    data: params,
    requestBaseUrl: 'expert'
  })
}
//专家查看在线咨询，线下会诊状态
export const show_status = () => {
  return request({
    url: "/expert/expert/expert/getRegisterOpenConsultOpen",
    method: 'post'
  })
}
//专家开启或关闭在线咨询
export const online_switch = () => {
  return request({
    url: "/expert/expert/expert/consultOpen",
    method: 'post'
  })
}
//专家开启或关闭线下会诊
export const offline_switch = () => {
  return request({
    url: "/expert/expert/expert/registerOpen",
    method: 'post'
  })
}
//专家强制关闭线下会诊
export const offline_switch_deep = () => {
  return request({
    url: "/expert/expert/expert/forceCloseRegister",
    method: 'post'
  })
}
//专家挂号信息
export const register_info_fn = (params) => {
  return request({
    url: "/buyer/user/userRegister/UserRegisterExpertStatistics",
    method: 'get',
    requestBaseUrl: "buyer"
  })
}
//在线问诊tabble数量
export const online_num = () => {
  return request({
    url: '/buyer/order/userConsult/UserConsultExpertStatistics',
    method: 'get',
    requestBaseUrl: "buyer"
  })
}
//评论集合
export const evaluate_api = (params) => {
  return request({
    url: '/expert/expert/expert/getExpertEvaluate',
    method: "post",
    data: params,
    requestBaseUrl: "expert"
  })
}
//专家问诊评价新增或回复
export const evaluate_answer = (params) => {
  return request({
    url: "/expert/expert/expertEvaluate/save",
    data: params,
    method: 'post',
    requestBaseUrl: 'expert'
  })
}
//专家问诊评价删除
export const del_answer = (id) => {
  return request({
    url: `/expert/expert/expertEvaluate/expert/${id}`,
    method: 'DELETE',
    requestBaseUrl: 'expert'
  })
}
//处方管理
export const prescription_api = (params) => {
  return request({
    url: '/expert/expert/expertPrescription/pagelist',
    method: "post",
    data: params,
    requestBaseUrl: "expert"
  })
}
//处方管理-删除处方
export const del_prescription = (ids) => {
  return request({
    url: `/expert/expert/expertPrescription/${ids}`,
    method: "delete",
    requestBaseUrl: "expert"
  })
}
//处方管理-新增或修改
export const add_prescription = (params) => {
  return request({
    url: '/expert/expert/expertPrescription/save',
    method: "post",
    data: params,
    requestBaseUrl: "expert"
  })
}
//处方管理-详情
export const detail_prescription = (prescriptionId) => {
  return request({
    url: `/expert/expert/expertPrescription/prescriptionDetails/${prescriptionId}`,
    method: "get",
    requestBaseUrl: "expert"
  })
}

//查询所有诊室
export const study_field = () => {
  return request({
    url: '/expert/site/site/siteAndRoom',
    method: 'get'
  })
}
//根据诊室ID查询诊室所有时间段
export const rooms_id = (siteRoomId) => {
  return request({
    url: `/expert/site/siteRoomTime/allTimePeriodsBySiteRoomId/${siteRoomId}`,
    method: 'get'
  })
}
//课程系列管理 列表
export const curriculum_list = (params) => {
  return request({
    url: "/expert/course/courseSeries/getCurrentExpertCourseSeriesPageList",
    method: "get",
    params,
    requestBaseUrl: "expert"
  })
}
//课程系列管理 新增或修改
export const curriculum_add = (params) => {
  return request({
    url: "/expert/course/courseSeries/save",
    method: "post",
    data: params,
    requestBaseUrl: "expert"
  })
}
//课程系列管理 课程类别
export const curriculum_category = () => {
  return request({
    url: "/expert/course/courseCategory/list",
    method: "get",
    requestBaseUrl: "expert"
  })
}
//课程系列管理 提交审核
export const curriculum_sub = (params) => {
  return request({
    url: "/expert/course/courseReviewed/save",
    method: "post",
    data: params,
    requestBaseUrl: "expert"
  })
}
//课程系列管理 删除
export const curriculum_del = (id) => {
  return request({
    url: `/expert/course/courseSeries/${id}`,
    method: "delete",
    requestBaseUrl: "expert"
  })
}
//课程系列管理 置顶
export const curriculum_top = (params) => {
  return request({
    url: '/expert/course/courseSeries/setCourseTop',
    method: "post",
    data: params,
    requestBaseUrl: "expert"
  })
}
//课程系列管理 取消置顶
export const curriculum_notop = (params) => {
  return request({
    url: '/expert/course/courseSeries/cancelCourseTop',
    method: "post",
    data: params,
    requestBaseUrl: "expert"
  })
}
//课程系列管理 上架下架  上架4  下架5
export const curriculum_put_down = (params) => {
  return request({
    url: '/expert/course/courseSeries/courseIsOnline',
    method: "post",
    data: params,
    requestBaseUrl: "expert"
  })
}
//课程系列管理 系列下的课程管理
export const curriculum_course = (courseSeriesId) => {
  return request({
    url: `/expert/course/course/getCourseByCourseSeriesId/${courseSeriesId}`,
    method: "get",
    requestBaseUrl: "expert"
  })
}
//课程系列管理 添加课程目录
export const add_course = (params) => {
  return request({
    url: '/expert/course/course/save',
    method: "post",
    data: params,
    requestBaseUrl: "expert"
  })
}
//课程系列管理 视频顺序 0置顶 1置底 2上移 3下移
export const move_course = (sortType, id) => {
  let formData = new FormData()
  formData.append('courseId', id)
  formData.append('sortType', sortType)
  return request({
    url: '/expert/course/course/courseSortHandler',
    method: "post",
    data: formData,
    requestBaseUrl: "expert"
  })
}
//课程系列管理 根据ID删除课程
export const del_course = (id) => {
  return request({
    url: `/expert/course/course/${id}`,
    method: "delete",
    requestBaseUrl: "expert"
  })
}

// 根据ID获取课程列表
export const getCourseById = (id) => {
  return request({
    url: `/expert/course/course/getCourseByCourseSeriesId/${id}`,
    method: 'get',
    requestBaseUrl: 'expert'
  });
}
// 根据ID获取课程列表
export const getCourseInfoById = (id) => {
  return request({
    url: `/expert/course/courseSeries/${id}`,
    method: 'get',
    requestBaseUrl: 'expert'
  });
}
// 课程系列评论列表
export const comment_list = (data) => {
  return request({
    url: '/courseSeriesBaseEvaluate/listByPage',
    method: 'post',
    data,
    requestBaseUrl: 'manager'
  });
}
// 课程系列评论评分
export const comment_rate = (seriesId) => {
  return request({
    url: `/courseSeriesBaseEvaluate/getEvaluateCount/${seriesId}`,
    method: 'get',
    requestBaseUrl: 'manager'
  });
}
//专家所有信息
export const expert_infoAll = (id) => {
  return request({
    url: `/expert/expert/expert/${id}`,
    method: 'get'
  })
}
//专家当前坐班
export const expert_zb = (expertId) => {
  return request({
    url: `/expert/site/siteRoomTime/allTimePeriodsByExpertId/${expertId}`,
    method: 'get'
  })
}
//专家当前坐班
export const expert_saveZb = (data) => {
  return request({
    url: '/expert/expert/expert/service/initiateAudit',
    method: 'POST',
    data: data,
    requestBaseUrl: "expert"
  })
}
//二维码下载
export const expert_QRCode = (params) => {
  return request({
    url: "/common/other/appVersion",
    method: 'get',
    params,
    requestBaseUrl: "common"
  })
}
//护士签到列表
export const qd_list = (params) => {
  return request({
    url: '/buyer/user/userRegister/signInList',
    method: "post",
    data: params,
    requestBaseUrl: 'buyer'
  })
}
//护士签到列表
export const qd_hushi = (id) => {
  return request({
    url: `/buyer/user/userRegister/arrive/${id}`,
    method: "put",
    requestBaseUrl: 'buyer'
  })
}
//护士查看预约
export const qd_yuyue = (id) => {
  return request({
    url: `/buyer/user/userRegister/${id}`,
    method: "get",
    requestBaseUrl: 'buyer'
  })
}
//叫号器呼叫
export const call_name = (id) => {
  return request({
    url: `/expert/pager/pager/waitCall/${id}`,
    method: "get",
    requestBaseUrl: 'expert'
  })
}
//旧手机号验证
export const oldMobild = () => {
  return request({
    url: "/expert/passport/verificationOldPhone",
    data: params,
    method: 'post',
    requestBaseUrl: "expert"
  })
}
/**
 * 
 * 评论点赞
 */
export const putfabulous = (id) => {
  return request({
    url: `/courseSeriesBaseEvaluate/like/${id}`,
    method: "get",
    requestBaseUrl: "manager"
  })
}
/**
 * 
 * 评论回复  
 * "courseSeriesId": 课程系列id,
  "evaluateType": "评论类型 0评价 1回复",
  "grade": 分数0到5,
   "pid": 评价传0,回复传回复对象的id
  "userEvaluate": "评论内容"
 */
export const answerComment = (params) => {
  return request({
    url: '/courseSeriesBaseEvaluate/save',
    data: params,
    method: 'post',
    requestBaseUrl: "manager"
  })
}
/**
 * 专家申请或者修改直播信息
 * courseCategory
 * endTime
 * name
 * roomDetail
 * startTime
 * type 	直播类型,可用值:KNOWLEDGE,GOODS
 */
export const applyLive = (params) => {
  return request({
    url: '/expert/broadcast/studio',
    data: params,
    method: 'post',
    requestBaseUrl: "expert"
  })
}
/**
 * 查看直播状态
 */
export const liveStatus = () => {
  return request({
    url: '/expert/broadcast/studio',
    method: 'get',
    requestBaseUrl: "expert"
  })
}
/**
 * 开启直播
 * status  开启或关闭状态,可用值:OPEN,CLOSE
 */
export const openLive = (params) => {
  return request({
    url: '/expert/broadcast/studio/openOrCloseLive',
    method: 'post',
    data: params,
    requestBaseUrl: "expert"
  })
}
/**
 * 直播记录
 * 
 */
export const liveRecordApi = (params) => {
  return request({
    url: '/expert/broadcast/studio/recode',
    method: 'get',
    data: params,
  })
}
/**
 * 删除直播记录
 */
 export const delliveRecord = (params) => {
  return request({
    url: '/expert/broadcast/studio/recode',
    method: 'post',
    data: params,
  })
}
/**
 * 专家被禁播后申诉
 */
 export const liveAppeal = (params) => {
  return request({
    url: '/expert/broadcast/appeal',
    method: 'post',
    data: params,
  })
}